<?php
class MPage extends MComponent {
    private $_id;

    public function __construct($pageId = NULL) {
        isset($pageId)?$this->_id = intval($pageId):$this->_id = -1;
    }

    public function getId() {
        return $this->_id;
    }

    public function setId($_id) {
        $this->_id = $_id;
    }

    public function render(){
        $page = Page::find($this->_id);
        if ($this->_request->isAdmin()){
            $this->_response->setModule(MApplication::ADMIN_MODULE);
        } else {
            $this->_response->setModule($this->_request->getModule());
        }
        $this->_response->setContent($page->html_content);
        $this->_response->render();
    }
}
?>
